package com.Spring.relation;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.Spring.autowire.Address;
import com.Spring.autowire.Person;

public class Main {
	public static void main(String[] args) {
		// 若将xml放在固定的包下那么就从bin目录下去查找，具体如下
		// ApplicationContext ctx = new
		// ClassPathXmlApplicationContext("com/Spring/autowire/beans-autowire1.xml");
		ApplicationContext ctx = new ClassPathXmlApplicationContext("beans-relation.xml");
//		Address address = (Address) ctx.getBean("address1");
//		System.out.println(address.toString());
//		Address address1 = (Address) ctx.getBean("address2");
//		System.out.println(address1.toString());
		Person p = (Person)ctx.getBean("person");
		System.out.println(p);
	}
}
